package com.rency.common.manager;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public enum ModelEnum {
    DAL("dal","执行数据库脚本"),
    MANAGER("manager","公用组件管理"),
    MEMCACHE("memcache","缓存调用"),
    MESSAGER("messager","消息发送"),
    MQ("mq","MQ消息发送"),
    SEQUENCE("sequence","SEQ序列号"),
    TRIGGER("trigger","定时任务"),
    UTILS("utils","工具包"),
    ;

    private String code;
    private String msg;

    ModelEnum(String code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public static ModelEnum get(String code){
        ModelEnum[] chars = ModelEnum.values();
        for(ModelEnum c : chars){
            if(c.getCode().toUpperCase().equals(code.toUpperCase())){
                return c;
            }
        }
        return null;
    }

    public String getCode(){
    	return this.code;
    }
    
    public String getMsg(){
    	return this.msg;
    }
    
    public String toString(){
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }
}
